package com.mycar.pajero;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.core.env.Environment;

import java.net.InetAddress;
import java.net.UnknownHostException;

@SpringBootApplication
public class PajeroApplication {

	private static Logger logger= LoggerFactory.getLogger(PajeroApplication.class);

	public static void main(String[] args) {

		SpringApplication app = new SpringApplication(PajeroApplication.class);

		Environment env = app.run(args).getEnvironment();
		try {
			logger.info("\n----------------------------------------------------------\n\t" +
							"Application '{}' is running! Access URLs:\n\t" +
							"Local: \thttp://localhost:{}\n\t" +
							"Address: \thttp://{}:{}\n" +
							"----------------------------------------------------------",
					env.getProperty("spring.application.name"),
					env.getProperty("server.port"),
					InetAddress.getLocalHost().getHostAddress(),
					env.getProperty("server.port"),
					env.getProperty("server.port"),
					env.getProperty("server.port"));
		} catch (UnknownHostException e) {
			logger.error(e.getMessage(),e);
		}

	}

}
